package org.framework.lazy.cloud.network.heartbeat.server.standalone.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.LazyNettyClientRouteApplication;
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.client.route.*;
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.dto.LazyNettyClientRouteDTO;
import org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.model.lazy.netty.client.route.LazyNettyClientRoute;
import org.springframework.web.bind.annotation.*;
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
import org.wu.framework.web.response.Result;
import org.wu.framework.web.spring.EasyController;

import java.util.List;

/**
 * describe 客户端代理路由规则
 *
 * @author Jia wei Wu
 * @date 2025/04/05 09:00 晚上
 * @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyController
 **/
@Tag(name = "客户端代理路由规则提供者")
@EasyController("/lazy/netty/client/route")
public class LazyNettyClientRouteProvider {

    @Resource
    private LazyNettyClientRouteApplication lazyNettyClientRouteApplication;

    /**
     * describe 新增客户端代理路由规则
     *
     * @param lazyNettyClientRouteStoryCommand 新增客户端代理路由规则
     * @return {@link Result<LazyNettyClientRoute>} 客户端代理路由规则新增后领域对象
     * @author Jia wei Wu
     * @date 2025/04/05 09:00 晚上
     **/

    @Operation(summary = "新增客户端代理路由规则")
    @PostMapping("/story")
    public Result<LazyNettyClientRoute> story(@RequestBody LazyNettyClientRouteStoryCommand lazyNettyClientRouteStoryCommand) {
        return lazyNettyClientRouteApplication.story(lazyNettyClientRouteStoryCommand);
    }

    /**
     * describe 批量新增客户端代理路由规则
     *
     * @param lazyNettyClientRouteStoryCommandList 批量新增客户端代理路由规则
     * @return {@link Result<List<LazyNettyClientRoute>>} 客户端代理路由规则新增后领域对象集合
     * @author Jia wei Wu
     * @date 2025/04/05 09:00 晚上
     **/

    @Operation(summary = "批量新增客户端代理路由规则")
    @PostMapping("/batchStory")
    public Result<List<LazyNettyClientRoute>> batchStory(@RequestBody List<LazyNettyClientRouteStoryCommand> lazyNettyClientRouteStoryCommandList) {
        return lazyNettyClientRouteApplication.batchStory(lazyNettyClientRouteStoryCommandList);
    }

    /**
     * describe 更新客户端代理路由规则
     *
     * @param lazyNettyClientRouteUpdateCommand 更新客户端代理路由规则
     * @return {@link Result<LazyNettyClientRoute>} 客户端代理路由规则领域对象
     * @author Jia wei Wu
     * @date 2025/04/05 09:00 晚上
     **/

    @Operation(summary = "更新客户端代理路由规则")
    @PutMapping("/updateOne")
    public Result<LazyNettyClientRoute> updateOne(@RequestBody LazyNettyClientRouteUpdateCommand lazyNettyClientRouteUpdateCommand) {
        return lazyNettyClientRouteApplication.updateOne(lazyNettyClientRouteUpdateCommand);
    }

    /**
     * describe 查询单个客户端代理路由规则
     *
     * @param lazyNettyClientRouteQueryOneCommand 查询单个客户端代理路由规则
     * @return {@link Result<LazyNettyClientRouteDTO>} 客户端代理路由规则DTO对象
     * @author Jia wei Wu
     * @date 2025/04/05 09:00 晚上
     **/

    @Operation(summary = "查询单个客户端代理路由规则")
    @GetMapping("/findOne")
    public Result<LazyNettyClientRouteDTO> findOne(@ModelAttribute LazyNettyClientRouteQueryOneCommand lazyNettyClientRouteQueryOneCommand) {
        return lazyNettyClientRouteApplication.findOne(lazyNettyClientRouteQueryOneCommand);
    }

    /**
     * describe 查询多个客户端代理路由规则
     *
     * @param lazyNettyClientRouteQueryListCommand 查询多个客户端代理路由规则
     * @return {@link Result<List<LazyNettyClientRouteDTO>>} 客户端代理路由规则DTO对象
     * @author Jia wei Wu
     * @date 2025/04/05 09:00 晚上
     **/

    @Operation(summary = "查询多个客户端代理路由规则")
    @GetMapping("/findList")
    public Result<List<LazyNettyClientRouteDTO>> findList(@ModelAttribute LazyNettyClientRouteQueryListCommand lazyNettyClientRouteQueryListCommand) {
        return lazyNettyClientRouteApplication.findList(lazyNettyClientRouteQueryListCommand);
    }

    /**
     * describe 分页查询多个客户端代理路由规则
     *
     * @param lazyNettyClientRouteQueryListCommand 分页查询多个客户端代理路由规则
     * @return {@link Result<LazyPage<LazyNettyClientRouteDTO>>} 分页客户端代理路由规则DTO对象
     * @author Jia wei Wu
     * @date 2025/04/05 09:00 晚上
     **/

    @Operation(summary = "分页查询多个客户端代理路由规则")
    @GetMapping("/findPage")
    public Result<LazyPage<LazyNettyClientRouteDTO>> findPage(@Parameter(description = "分页大小") @RequestParam(defaultValue = "10", value = "size") int size,
                                                              @Parameter(description = "当前页数") @RequestParam(defaultValue = "1", value = "current") int current, @ModelAttribute LazyNettyClientRouteQueryListCommand lazyNettyClientRouteQueryListCommand) {
        return lazyNettyClientRouteApplication.findPage(size, current, lazyNettyClientRouteQueryListCommand);
    }

    /**
     * describe 删除客户端代理路由规则
     *
     * @param lazyNettyClientRouteRemoveCommand 删除客户端代理路由规则
     * @return {@link Result<LazyNettyClientRoute>} 客户端代理路由规则
     * @author Jia wei Wu
     * @date 2025/04/05 09:00 晚上
     **/

    @Operation(summary = "删除客户端代理路由规则")
    @DeleteMapping("/remove")
    public Result<LazyNettyClientRoute> remove(@ModelAttribute LazyNettyClientRouteRemoveCommand lazyNettyClientRouteRemoveCommand) {
        return lazyNettyClientRouteApplication.remove(lazyNettyClientRouteRemoveCommand);
    }
}